<script lang="jsx" setup>
import dayjs from 'dayjs';
import { nextTick, ref } from 'vue';

const tableRef = ref(null);
const searchParams = ref({ techId: null });
const column = [
  {
    key: 'dataIndex',
    dataIndex: 'dataIndex',
    title: '序号',
    width: 70,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'fileMouldName',
    dataIndex: 'fileMouldName',
    title: '项目名称',
    align: 'center',
    checked: true,
    ellipsis: true,
    width: 130
  },
  {
    key: 'fileName',
    dataIndex: 'fileName',
    title: '文件名',
    align: 'center',
    checked: true,
    ellipsis: true,
    width: 130
  },

  {
    key: 'createBy',
    dataIndex: 'createBy',
    title: '创建人',
    align: 'center',
    checked: true,
    ellipsis: true,
    width: 130
  },
  {
    key: 'createDate',
    dataIndex: 'createDate',
    title: '创建时间',
    align: 'center',
    checked: true,
    ellipsis: true,
    width: 160,
    customRender: ({ record }) => {
      return dayjs(record.createDate).format('YYYY-MM-DD HH:mm:ss');
    }
  },
  {
    key: 'updateDate',
    dataIndex: 'updateDate',
    title: '最后修改时间',
    align: 'center',
    checked: true,
    ellipsis: true,
    width: 160,
    customRender: ({ record }) => {
      return dayjs(record.updateDate).format('YYYY-MM-DD HH:mm:ss');
    }
  }
];

function getData(params) {
  searchParams.value = params;
  nextTick(() => {
    tableRef.value.getData();
  });
}

defineExpose({
  getData
});
</script>

<template>
  <Table
    ref="tableRef"
    v-model:searchParams="searchParams"
    class="h-full"
    :column="column"
    :show-row-selection="false"
    row-key="id"
    :scroll="{ y: 'auto' }"
    :is-init-get-data="false"
    url="/erpsyncmes/mi/file/mould/list"
    :is-pagination="false"
    :auto-generate-uuid="true"
  >
    <template #title><span class="color-#646cff">工艺工程文件</span></template>
  </Table>
</template>

<style lang="scss" scoped></style>
